from app import db


class URLGenerate(db.Model):
    __tablename__ = 'url_generate'

    id = db.Column(db.BigInteger, primary_key=True, autoincrement=True)
    long_url = db.Column(db.String(255), nullable=True)
    short_url = db.Column(db.String(255), nullable=True)

    def to_json(self):
        return {
            'id': self.id,
            'long_url': self.long_url,
            'short_url': self.short_url
        }